package cn.rxls.admin.shop.service.impl;

import cn.rxls.admin.shop.dto.PageUserDTO;
import cn.rxls.admin.shop.entity.User;
import cn.rxls.admin.shop.mapper.UserMapper;
import cn.rxls.admin.shop.service.UserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户表(User)表服务实现类
 *
 * @author makejava
 * @since 2024-05-10 02:17:09
 */
@Service("userService")
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    private final UserMapper userMapper;

    UserServiceImpl(UserMapper userMapper){
        this.userMapper = userMapper;
    }
    /**
     * 分页查询
     *
     * @param dto 参数对象
     * @return 多条数据
     */
    @Override
    public List<User> page(PageUserDTO dto) {
        //计算页码
        dto.setPage((dto.getPage()-1)*dto.getSize());
        return userMapper.page(dto);
    }
}

